package com.nelson.musicplayer.helper

import android.content.Context
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.nelson.musicplayer.appContext
import com.nelson.musicplayer.util.loadImage
import com.nelson.musicplayer.util.loadServerImage
import com.youth.banner.loader.ImageLoader

/**
 * @author nelson
 * @since 2020-07-29
 */
class GlideImageLoader : ImageLoader() {
    override fun displayImage(context: Context?, path: Any?, imageView: ImageView?) {
        (path as? String)?.let {
            if (path.contains("http:")) {
                loadImage(imageView, it)
            } else {
                loadServerImage(imageView, it)
            }
            return
        }
        imageView?.let { Glide.with(appContext).load(path).into(it) }
    }
}